#include <iostream>

class Test
{
    public:
    Test(){std::cout<<"构造函数!\n";}
    ~Test(){std::cout<<"构造函数!\n";}
    void show()
    {
        std::cout<<"helloworld";
    }
};

class SmartPoint
{
public:
    SmartPoint(Test *t):t(t){}

    ~SmartPoint()
    {
        delete t;
    }
    Test *operator->()
    {
        return t;
    }

    Test& operator*()
    {
        return *t;
    }
private:
    Test *t;
};

int main()
{
    SmartPoint p(new Test);

    (*p).show();
    return 0;
}